"use strict"
//查询日志
const mvc = require("cosjs.mvc");
exports.query = async function () {
    const sid = this.get('sid', 'int');
    const uid = this.get('uid', 'string');
    const event = this.get('event', 'string');
    const name = this.get('name', 'string');
    if (!sid) {
        return [];
    }
    let plog_mode = mvc.model.mongo('plog', sid);
    let _que = {};
    if (uid) {
        _que['uid'] = uid;
    }
    if (event) {
        _que['event'] = event;
    }
    if (name) {
        _que['name'] = name;
    }
    let $page = this.get('page', 'int') || 1;
    let $size = this.get('size', 'int') || 20;
    let dbsort = { "stime": -1 };
    let _ret = await plog_mode.page(_que, $page, $size, dbsort, {});
    return _ret;
}


